package com.shuqi.model.parse.parser;

import org.xml.sax.Attributes;
import org.xml.sax.SAXException;

import com.shuqi.model.bean.MyFavoritAddBean;
import com.shuqi.model.bean.MyFavoritRemoveBean;
import com.shuqi.model.parse.HandlerBase;

public class MyFavoritAddParser extends HandlerBase {
    private MyFavoritAddBean myFavoritAddBean;
    private String preTag;

    @Override
    public Object getParsedData() {
        return myFavoritAddBean;
    }

    @Override
    public void startDocument() throws SAXException {
        super.startDocument();
    }

    @Override
    public void startElement(String uri, String localName, String qName, Attributes attributes)
            throws SAXException {

        if ("Result".equals(qName)) {
            myFavoritAddBean = new MyFavoritAddBean();
            myFavoritAddBean.setState(attributes.getValue("state"));
            myFavoritAddBean.setMessage(attributes.getValue("message"));
            myFavoritAddBean.setCollected(attributes.getValue("collected"));
        }

        preTag = qName;
    }

    @Override
    public void characters(char[] ch, int start, int length) throws SAXException {}

    @Override
    public void endElement(String uri, String localName, String qName) throws SAXException {
        preTag = null;
    }



    @Override
    public void endDocument() throws SAXException {
    }

}
